package com.k.base.jdk.optionals;

import java.util.Optional;

public class OptionalTest {
    public static void main(String[] args) {
        String str = "addd";
        Optional<String> u = getUserName(str);
        if(u.isPresent()){
            System.out.println(u.get());
        }else{
            System.out.println("null");
        }

    }
    public static Optional<String> getUserName(String username){
        return Optional.ofNullable(username);
    }
}
